<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <!--<form class="form-horizontal m-t" id="signupForm">-->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">选择金额：</label>
                            <div class="col-sm-4">
                                <select id="money" name="money" class="form-control">
                                    <option value="">请选择</option>
                                    <option th:each="money:${money}" th:value="${money}"
                                            th:text="${money}"></option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-10 col-sm-offset-2">
                                <button  class="btn btn-primary" onclick=" save()">生成支付链接</button>
                            </div>
                        </div>

                    <!--</form>-->
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/md5.min.js"></script>
<script>

    function save() {

        var money =  $("#money").val();

        $.ajax({
            cache: true,
            type: "POST",
            url: "/demo/demo/money",
            data: {"money":money},// 你的formid
            async: false,
            error: function (request) {
                alert("Connection error");
            },
            success: function (data) {

                if (data.result == 0) {
                    window.location.href=data.url;
                }else   if (data.result == 1) {
                   alert("未选择金额")
                }else   if (data.result == 2) {
                   alert("无可用通道")
                }else {
                    alert("生成失败")
                }
                // window.event.returnValue=false;

            }
        });

    }


</script>
</body>
</html>
